﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEngine;

// Token: 0x020000A6 RID: 166
public class MMD4MecanimSpeechHelper : MMD4MecanimMorphHelper
{
	// Token: 0x060003E0 RID: 992 RVA: 0x0001DACC File Offset: 0x0001BCCC
	public float GetElementLength()
	{
		return (this.elementLength <= 0f) ? MMD4MecanimSpeechHelper.defaultElementLength : this.elementLength;
	}

	// Token: 0x060003E1 RID: 993 RVA: 0x0001DAEE File Offset: 0x0001BCEE
	public float GetConsonantLength()
	{
		return (this.consonantLength <= 0f) ? MMD4MecanimSpeechHelper.defaultConsonantLength : this.consonantLength;
	}

	// Token: 0x060003E2 RID: 994 RVA: 0x0001DB10 File Offset: 0x0001BD10
	private static bool _IsEscape(char ch)
	{
		return ch == '^' || ch == '`' || ch == '/' || ch == '-' || ch == '~';
	}

	// Token: 0x170000A0 RID: 160
	// (get) Token: 0x060003E3 RID: 995 RVA: 0x0001DB3C File Offset: 0x0001BD3C
	public override bool isProcessing
	{
		get
		{
			return this.speechAudioClip != null || !string.IsNullOrEmpty(this.speechMorphText) || (this._playingDataList != null && this._playingPos < this._playingDataList.Count);
		}
	}

	// Token: 0x170000A1 RID: 161
	// (get) Token: 0x060003E4 RID: 996 RVA: 0x0001DB90 File Offset: 0x0001BD90
	public override bool isAnimating
	{
		get
		{
			return base.isAnimating || (this.speechAudioClip != null || !string.IsNullOrEmpty(this.speechMorphText)) || (this._playingDataList != null && this._playingPos < this._playingDataList.Count);
		}
	}

	// Token: 0x060003E5 RID: 997 RVA: 0x0001DBF1 File Offset: 0x0001BDF1
	protected override void Start()
	{
		base.Start();
		if (this._model != null)
		{
			this._audioSource = this._model.GetAudioSource();
		}
	}

	// Token: 0x060003E6 RID: 998 RVA: 0x0001DC1B File Offset: 0x0001BE1B
	protected override void Update()
	{
		this._UpdateSpeech(Time.deltaTime);
		base.Update();
	}

	// Token: 0x060003E7 RID: 999 RVA: 0x0001DC2E File Offset: 0x0001BE2E
	public override void ForceUpdate()
	{
		this._UpdateSpeech(0f);
		base.ForceUpdate();
	}

	// Token: 0x060003E8 RID: 1000 RVA: 0x0001DC44 File Offset: 0x0001BE44
	public void ResetSpeech()
	{
		this.speechAudioClip = null;
		this.speechMorphText = string.Empty;
		if (this._playingDataList.Count > 0)
		{
			if (this._isPlayingAudioClip)
			{
				this._isPlayingAudioClip = false;
				if (this._audioSource != null)
				{
					this._audioSource.Stop();
					this._audioSource.clip = null;
				}
			}
			if (this._isPlayingMorph)
			{
				this._isPlayingMorph = false;
				this.morphName = string.Empty;
				this.morphWeight = 0f;
			}
			this._playingDataList.Clear();
			this._playingPos = 0;
			this.ForceUpdate();
		}
	}

	// Token: 0x060003E9 RID: 1001 RVA: 0x0001DCF0 File Offset: 0x0001BEF0
	private void _UpdateSpeech(float deltaTime)
	{
		this._UpdatePlayingSpeech();
		if (this._playingDataList == null || this._playingDataList.Count == 0)
		{
			return;
		}
		if (this._playingPos >= this._playingDataList.Count)
		{
			if (this._isPlayingAudioClip)
			{
				this._isPlayingAudioClip = false;
				if (this._audioSource != null)
				{
					this._audioSource.Stop();
					this._audioSource.clip = null;
				}
			}
			if (this._isPlayingMorph)
			{
				this._isPlayingMorph = false;
				this.morphName = string.Empty;
				this.morphWeight = 0f;
			}
			this._playingDataList.Clear();
			this._playingPos = 0;
			return;
		}
		MMD4MecanimSpeechHelper.PlayingData playingData = this._playingDataList[this._playingPos];
		while (playingData.playingTime >= playingData.playingLength)
		{
			if (this._isPlayingAudioClip)
			{
				this._isPlayingAudioClip = false;
				if (this._audioSource != null)
				{
					this._audioSource.Stop();
					this._audioSource.clip = null;
				}
			}
			float playingTime = playingData.playingTime - playingData.playingLength;
			if (++this._playingPos >= this._playingDataList.Count)
			{
				if (this._isPlayingMorph)
				{
					this._isPlayingMorph = false;
					this.morphName = string.Empty;
					this.morphWeight = 0f;
				}
				return;
			}
			playingData = this._playingDataList[this._playingPos];
			playingData.playingTime = playingTime;
		}
		if (playingData.morphPos < 0)
		{
			playingData.morphPos = 0;
			if (playingData.audioClip != null)
			{
				this._isPlayingAudioClip = true;
				if (this._audioSource != null)
				{
					this._audioSource.clip = playingData.audioClip;
					this._audioSource.Play();
				}
			}
			if (playingData.morphDataList != null && playingData.morphPos < playingData.morphDataList.Count)
			{
				this._isPlayingMorph = true;
				this._UpdateMorph(playingData.morphDataList[playingData.morphPos].morphName);
			}
			else if (this._isPlayingMorph)
			{
				this._isPlayingMorph = false;
				this.morphName = string.Empty;
				this.morphWeight = 0f;
			}
		}
		bool flag = false;
		if (this._isPlayingAudioClip && this._audioSource != null)
		{
			if (this._audioSource.isPlaying)
			{
				playingData.playingTime = this._audioSource.time;
				flag = true;
			}
			else if (playingData.playingTime < playingData.playingLength)
			{
				playingData.playingTime = playingData.playingLength;
				flag = true;
			}
		}
		if (playingData.morphTime < playingData.playingTime && playingData.morphDataList != null)
		{
			float num = playingData.playingTime - playingData.morphTime;
			int morphPos = playingData.morphPos;
			while (playingData.morphPos < playingData.morphDataList.Count)
			{
				float morphLength = playingData.morphDataList[playingData.morphPos].morphLength;
				if (morphLength >= num)
				{
					break;
				}
				playingData.morphTime += morphLength;
				num -= morphLength;
				playingData.morphPos++;
			}
			if (morphPos != playingData.morphPos && playingData.morphPos < playingData.morphDataList.Count)
			{
				this._UpdateMorph(playingData.morphDataList[playingData.morphPos].morphName);
			}
		}
		if (!flag)
		{
			playingData.playingTime += deltaTime;
		}
	}

	// Token: 0x060003EA RID: 1002 RVA: 0x0001E0A8 File Offset: 0x0001C2A8
	private void _UpdateMorph(string morphName)
	{
		if (this._validateMorphBits == 0)
		{
			MMD4MecanimModel component = base.GetComponent<MMD4MecanimModel>();
			if (component != null && MMD4MecanimSpeechHelper.hiraMorphNameList != null)
			{
				for (int i = 0; i < MMD4MecanimSpeechHelper.hiraMorphNameList.Count; i++)
				{
					if (component.GetMorph(MMD4MecanimSpeechHelper.hiraMorphNameList[i]) != null)
					{
						this._validateMorphBits |= 1 << i;
					}
				}
			}
			if (this._validateMorphBits == 0)
			{
				this._validateMorphBits = 31;
			}
		}
		float morphWeight = 0f;
		if (!string.IsNullOrEmpty(morphName))
		{
			morphWeight = 1f;
			if (MMD4MecanimSpeechHelper.hiraMorphNameList != null)
			{
				if (morphName == MMD4MecanimSpeechHelper.hiraMorphNameList[1] && (this._validateMorphBits & 2) == 0)
				{
					morphName = MMD4MecanimSpeechHelper.hiraMorphNameList[0];
					morphWeight = 0.5f;
				}
				else if (morphName == MMD4MecanimSpeechHelper.hiraMorphNameList[2] && (this._validateMorphBits & 4) == 0)
				{
					morphName = MMD4MecanimSpeechHelper.hiraMorphNameList[0];
					morphWeight = 0.3f;
				}
				else if (morphName == MMD4MecanimSpeechHelper.hiraMorphNameList[3] && (this._validateMorphBits & 8) == 0)
				{
					morphName = MMD4MecanimSpeechHelper.hiraMorphNameList[0];
					morphWeight = 0.5f;
				}
				else if (morphName == MMD4MecanimSpeechHelper.hiraMorphNameList[4] && (this._validateMorphBits & 16) == 0)
				{
					morphName = MMD4MecanimSpeechHelper.hiraMorphNameList[0];
					morphWeight = 0.8f;
				}
			}
		}
		this.morphName = morphName;
		this.morphWeight = morphWeight;
	}

	// Token: 0x060003EB RID: 1003 RVA: 0x0001E24C File Offset: 0x0001C44C
	private void _UpdatePlayingSpeech()
	{
		if (this.speechAudioClip != null || !string.IsNullOrEmpty(this.speechMorphText))
		{
			MMD4MecanimSpeechHelper.PlayingData playingData = this._ParsePlayingData(this.speechAudioClip, this.speechMorphText);
			this.speechAudioClip = null;
			this.speechMorphText = string.Empty;
			this._playingDataList.Clear();
			this._playingPos = 0;
			if (this._isPlayingAudioClip)
			{
				this._isPlayingAudioClip = false;
				if (this._audioSource != null)
				{
					this._audioSource.Stop();
					this._audioSource.clip = null;
				}
			}
			if (playingData != null)
			{
				this._playingDataList.Add(playingData);
			}
		}
	}

	// Token: 0x060003EC RID: 1004 RVA: 0x0001E300 File Offset: 0x0001C500
	private MMD4MecanimSpeechHelper.PlayingData _ParsePlayingData(AudioClip audioClip, string morphText)
	{
		MMD4MecanimSpeechHelper.PlayingData playingData = new MMD4MecanimSpeechHelper.PlayingData();
		playingData.audioClip = audioClip;
		playingData.playingLength = 0f;
		playingData.playingTime = 0f;
		playingData.morphPos = -1;
		playingData.morphTime = 0f;
		if (!string.IsNullOrEmpty(morphText))
		{
			playingData.morphDataList = this._ParseMorphText(morphText);
		}
		else
		{
			playingData.morphDataList = this._ParseMorphText(Path.GetFileNameWithoutExtension(audioClip.name));
		}
		if (playingData.morphDataList != null)
		{
			float num = 0f;
			int num2 = 0;
			for (int i = 0; i < playingData.morphDataList.Count; i++)
			{
				char morphChar = playingData.morphDataList[i].morphChar;
				if (playingData.morphDataList[i].morphLength == 0f)
				{
					if (morphChar != '^' && morphChar != '`')
					{
						num2++;
					}
				}
				else
				{
					num += playingData.morphDataList[i].morphLength;
				}
			}
			float num3 = this.GetElementLength();
			if (audioClip != null)
			{
				playingData.playingLength = audioClip.length;
				if (playingData.playingLength <= num)
				{
					playingData.playingLength = num;
					num3 = 0f;
				}
				else if (num2 > 0)
				{
					num3 = (playingData.playingLength - num) / (float)num2;
				}
			}
			else
			{
				playingData.playingLength = num + num3 * (float)num2;
			}
			if (num3 > 0f)
			{
				for (int j = 0; j < playingData.morphDataList.Count; j++)
				{
					char morphChar2 = playingData.morphDataList[j].morphChar;
					if (playingData.morphDataList[j].morphLength == 0f && morphChar2 != '^' && morphChar2 != '`')
					{
						MMD4MecanimSpeechHelper.MorphData value = playingData.morphDataList[j];
						value.morphLength = num3;
						playingData.morphDataList[j] = value;
					}
				}
				float num4 = this.GetConsonantLength();
				for (int k = 0; k < playingData.morphDataList.Count; k++)
				{
					char morphChar3 = playingData.morphDataList[k].morphChar;
					if (playingData.morphDataList[k].morphLength == 0f)
					{
						if (morphChar3 == '^' || morphChar3 == '`')
						{
							int index = k;
							for (k++; k < playingData.morphDataList.Count; k++)
							{
								morphChar3 = playingData.morphDataList[k].morphChar;
								if (morphChar3 != '^' && morphChar3 != '`')
								{
									float morphLength = playingData.morphDataList[k].morphLength;
									float morphLength2;
									if (num4 * 2f <= morphLength)
									{
										MMD4MecanimSpeechHelper.MorphData value2 = playingData.morphDataList[k];
										value2.morphLength = morphLength - num4;
										playingData.morphDataList[k] = value2;
										morphLength2 = num4;
									}
									else
									{
										MMD4MecanimSpeechHelper.MorphData value3 = playingData.morphDataList[k];
										value3.morphLength = morphLength * 0.5f;
										playingData.morphDataList[k] = value3;
										morphLength2 = value3.morphLength;
									}
									MMD4MecanimSpeechHelper.MorphData value4 = playingData.morphDataList[index];
									value4.morphLength = morphLength2;
									playingData.morphDataList[index] = value4;
									break;
								}
								if (playingData.morphDataList[k].morphLength != 0f)
								{
									break;
								}
							}
						}
					}
				}
			}
		}
		else if (audioClip != null)
		{
			playingData.playingLength = audioClip.length;
		}
		return playingData;
	}

	// Token: 0x060003ED RID: 1005 RVA: 0x0001E6E4 File Offset: 0x0001C8E4
	private List<MMD4MecanimSpeechHelper.MorphData> _ParseMorphText(string morphText)
	{
		if (string.IsNullOrEmpty(morphText))
		{
			return null;
		}
		StringBuilder stringBuilder = new StringBuilder();
		List<MMD4MecanimSpeechHelper.MorphData> list = new List<MMD4MecanimSpeechHelper.MorphData>();
		bool flag = false;
		bool flag2 = false;
		int i = 0;
		while (i < morphText.Length)
		{
			string morphScript = null;
			char c = morphText[i];
			if (c == '[')
			{
				int num;
				for (i = (num = i + 1); i < morphText.Length; i++)
				{
					if (morphText[i] == ']')
					{
						int num2 = MMD4MecanimCommon.ToInt(morphText, num, i - num);
						if (flag2 && list.Count > 0)
						{
							MMD4MecanimSpeechHelper.MorphData value = list[list.Count - 1];
							value.morphLength = (float)num2 * 0.001f;
							list[list.Count - 1] = value;
						}
						else
						{
							list.Add(new MMD4MecanimSpeechHelper.MorphData
							{
								morphChar = ' ',
								morphName = string.Empty,
								morphLength = (float)num2 * 0.001f
							});
						}
						i++;
						break;
					}
				}
				flag2 = false;
			}
			else
			{
				if (MMD4MecanimSpeechHelper._IsEscape(c))
				{
					MMD4MecanimSpeechHelper.MorphData item = default(MMD4MecanimSpeechHelper.MorphData);
					item.morphChar = c;
					item.morphName = string.Empty;
					switch (c)
					{
					case '-':
					case '/':
						goto IL_1A5;
					default:
						switch (c)
						{
						case '^':
							item.morphName = MMD4MecanimSpeechHelper.hiraMorphNameList[2];
							break;
						default:
							if (c == '~')
							{
								goto IL_1A5;
							}
							break;
						case '`':
							item.morphName = string.Empty;
							break;
						}
						break;
					}
					IL_1D4:
					flag2 = true;
					list.Add(item);
					i++;
					continue;
					IL_1A5:
					if (list.Count > 0)
					{
						item.morphName = list[list.Count - 1].morphName;
					}
					goto IL_1D4;
				}
				if (MMD4MecanimCommon.IsAlphabet(c))
				{
					string morphScript2 = null;
					bool flag3 = false;
					c = MMD4MecanimCommon.ToHalfLower(c);
					if (i + 1 < morphText.Length && MMD4MecanimCommon.IsAlphabet(morphText[i + 1]))
					{
						char value2 = MMD4MecanimCommon.ToHalfLower(morphText[i + 1]);
						if (i + 2 < morphText.Length && MMD4MecanimCommon.IsAlphabet(morphText[i + 2]))
						{
							char value3 = MMD4MecanimCommon.ToHalfLower(morphText[i + 2]);
							stringBuilder.Remove(0, stringBuilder.Length);
							stringBuilder.Append(c);
							stringBuilder.Append(value2);
							stringBuilder.Append(value3);
							if (MMD4MecanimSpeechHelper.englishPhraseDictionary.TryGetValue(stringBuilder.ToString(), out morphScript2))
							{
								this._AddMorphData(list, morphScript2);
								flag3 = true;
								i += 3;
							}
						}
						if (!flag3)
						{
							stringBuilder.Remove(0, stringBuilder.Length);
							stringBuilder.Append(c);
							stringBuilder.Append(value2);
							if (MMD4MecanimSpeechHelper.englishPhraseDictionary.TryGetValue(stringBuilder.ToString(), out morphScript2))
							{
								this._AddMorphData(list, morphScript2);
								flag3 = true;
								i += 2;
							}
						}
					}
					if (!flag3)
					{
						if (!flag && (morphText[i] == 'I' || morphText[i] == 'Ｉ'))
						{
							this._AddMorphData(list, "ai");
						}
						else if (i > 0 && MMD4MecanimCommon.ToHalfLower(morphText[i - 1]) == 'e' && c == 'e')
						{
							this._AddMorphData(list, "-");
						}
						else if (MMD4MecanimSpeechHelper.englishPronunDictionary.TryGetValue(c, out morphScript2))
						{
							this._AddMorphData(list, morphScript2);
						}
						else
						{
							this._AddMorphData(list, " ");
						}
						i++;
					}
					flag = true;
					flag2 = true;
				}
				else if (MMD4MecanimSpeechHelper.japanesePronunDictionary.TryGetValue(c, out morphScript))
				{
					string morphScript3 = null;
					if (i + 1 < morphText.Length && MMD4MecanimSpeechHelper.japanesePostPhraseDictionary.TryGetValue(morphText[i + 1], out morphScript3))
					{
						string morphScript4 = null;
						if (MMD4MecanimSpeechHelper.japanesePhraseDictionary.TryGetValue(morphText.Substring(i, 2), out morphScript4))
						{
							this._AddMorphData(list, morphScript4);
						}
						else
						{
							this._AddMorphData(list, morphScript);
							this._AddMorphData(list, morphScript3);
						}
						i += 2;
					}
					else
					{
						this._AddMorphData(list, morphScript);
						i++;
					}
					flag = false;
					flag2 = true;
				}
				else
				{
					if (i + 1 < morphText.Length)
					{
						string text = null;
						if (MMD4MecanimSpeechHelper.punctuatDictionary.TryGetValue(c, out text))
						{
							this._AddMorphData(list, "   ");
						}
					}
					flag = false;
					flag2 = false;
					i++;
				}
			}
		}
		return list;
	}

	// Token: 0x060003EE RID: 1006 RVA: 0x0001EB9C File Offset: 0x0001CD9C
	private void _AddMorphData(List<MMD4MecanimSpeechHelper.MorphData> morphDataList, string morphScript)
	{
		if (morphDataList != null && morphScript != null)
		{
			MMD4MecanimSpeechHelper.MorphData item = default(MMD4MecanimSpeechHelper.MorphData);
			for (int i = 0; i < morphScript.Length; i++)
			{
				item.morphChar = morphScript[i];
				item.morphName = string.Empty;
				char morphChar = item.morphChar;
				switch (morphChar)
				{
				case '^':
					item.morphName = MMD4MecanimSpeechHelper.hiraMorphNameList[2];
					break;
				default:
					switch (morphChar)
					{
					case '-':
					case '/':
						break;
					default:
						if (morphChar == 'n')
						{
							item.morphName = MMD4MecanimSpeechHelper.hiraMorphNameList[2];
							goto IL_188;
						}
						if (morphChar == 'o')
						{
							item.morphName = MMD4MecanimSpeechHelper.hiraMorphNameList[4];
							goto IL_188;
						}
						if (morphChar == 'i')
						{
							item.morphName = MMD4MecanimSpeechHelper.hiraMorphNameList[1];
							goto IL_188;
						}
						if (morphChar == 'u')
						{
							item.morphName = MMD4MecanimSpeechHelper.hiraMorphNameList[2];
							goto IL_188;
						}
						if (morphChar != '~')
						{
							goto IL_188;
						}
						break;
					}
					if (morphDataList.Count > 0)
					{
						item.morphName = morphDataList[morphDataList.Count - 1].morphName;
					}
					break;
				case '`':
					item.morphName = string.Empty;
					break;
				case 'a':
					item.morphName = MMD4MecanimSpeechHelper.hiraMorphNameList[0];
					break;
				case 'e':
					item.morphName = MMD4MecanimSpeechHelper.hiraMorphNameList[3];
					break;
				}
				IL_188:
				morphDataList.Add(item);
			}
		}
	}

	// Token: 0x04000549 RID: 1353
	public AudioClip speechAudioClip;

	// Token: 0x0400054A RID: 1354
	public string speechMorphText;

	// Token: 0x0400054B RID: 1355
	public float elementLength;

	// Token: 0x0400054C RID: 1356
	public float consonantLength;

	// Token: 0x0400054D RID: 1357
	private static readonly float defaultElementLength = 0.2f;

	// Token: 0x0400054E RID: 1358
	private static readonly float defaultConsonantLength = 0.1f;

	// Token: 0x0400054F RID: 1359
	private static List<string> hiraMorphNameList = new List<string>
	{
		"あ",
		"い",
		"う",
		"え",
		"お"
	};

	// Token: 0x04000550 RID: 1360
	private static Dictionary<string, string> englishPhraseDictionary = new Dictionary<string, string>
	{
		{
			"ch",
			"i"
		},
		{
			"ck",
			"u"
		},
		{
			"cs",
			"uu"
		},
		{
			"dy",
			"i-"
		},
		{
			"ff",
			"u"
		},
		{
			"ght",
			"o"
		},
		{
			"kni",
			"ai"
		},
		{
			"llo",
			"o-"
		},
		{
			"phy",
			"i"
		},
		{
			"ss",
			"/u"
		},
		{
			"ty",
			"i-"
		},
		{
			"th",
			"u"
		},
		{
			"ca",
			"a"
		},
		{
			"ci",
			"i"
		},
		{
			"cu",
			"u"
		},
		{
			"ce",
			"e"
		},
		{
			"co",
			"o"
		},
		{
			"qa",
			"a"
		},
		{
			"qi",
			"i"
		},
		{
			"qu",
			"u"
		},
		{
			"qe",
			"e"
		},
		{
			"qo",
			"o"
		},
		{
			"ka",
			"a"
		},
		{
			"ki",
			"i"
		},
		{
			"ku",
			"u"
		},
		{
			"ke",
			"e"
		},
		{
			"ko",
			"o"
		},
		{
			"ga",
			"a"
		},
		{
			"gi",
			"ai"
		},
		{
			"gu",
			"u"
		},
		{
			"ge",
			"e"
		},
		{
			"go",
			"o-"
		},
		{
			"sa",
			"^a"
		},
		{
			"si",
			"i/"
		},
		{
			"su",
			"u"
		},
		{
			"se",
			"^u"
		},
		{
			"so",
			"^o"
		},
		{
			"sha",
			"^a"
		},
		{
			"shi",
			"i"
		},
		{
			"shu",
			"u"
		},
		{
			"she",
			"^i-"
		},
		{
			"sho",
			"^o"
		},
		{
			"xa",
			"^a"
		},
		{
			"xi",
			"^i"
		},
		{
			"xu",
			"^u"
		},
		{
			"xe",
			"^e"
		},
		{
			"xo",
			"^o"
		},
		{
			"za",
			"^a"
		},
		{
			"zi",
			"^i"
		},
		{
			"zu",
			"^u"
		},
		{
			"ze",
			"^e"
		},
		{
			"zo",
			"^o"
		},
		{
			"ja",
			"^a"
		},
		{
			"ji",
			"i"
		},
		{
			"ju",
			"u"
		},
		{
			"je",
			"^e"
		},
		{
			"jo",
			"^o"
		},
		{
			"ta",
			"a"
		},
		{
			"ti",
			"i"
		},
		{
			"tu",
			"u"
		},
		{
			"te",
			"^e"
		},
		{
			"to",
			"u-"
		},
		{
			"fa",
			"^a"
		},
		{
			"fi",
			"^i"
		},
		{
			"fu",
			"u"
		},
		{
			"fe",
			"^e"
		},
		{
			"fo",
			"^o"
		},
		{
			"da",
			"a"
		},
		{
			"di",
			"i"
		},
		{
			"du",
			"u"
		},
		{
			"de",
			"e"
		},
		{
			"do",
			"u-"
		},
		{
			"na",
			"^a"
		},
		{
			"ni",
			"ai"
		},
		{
			"nu",
			"u"
		},
		{
			"ne",
			"u"
		},
		{
			"no",
			"^o"
		},
		{
			"nya",
			"^a"
		},
		{
			"nyi",
			"i"
		},
		{
			"nyu",
			"u"
		},
		{
			"nye",
			"e"
		},
		{
			"nyo",
			"^o"
		},
		{
			"ha",
			"a"
		},
		{
			"hi",
			"ai"
		},
		{
			"hu",
			"u"
		},
		{
			"he",
			"e"
		},
		{
			"ho",
			"o"
		},
		{
			"pa",
			"`a"
		},
		{
			"pi",
			"`i"
		},
		{
			"pu",
			"`u"
		},
		{
			"pe",
			"`e"
		},
		{
			"po",
			"`o"
		},
		{
			"ba",
			"`a"
		},
		{
			"bi",
			"`i"
		},
		{
			"bu",
			"`u"
		},
		{
			"be",
			"i"
		},
		{
			"bo",
			"o"
		},
		{
			"ma",
			"`a"
		},
		{
			"mi",
			"`i"
		},
		{
			"mu",
			"`u"
		},
		{
			"me",
			"`e"
		},
		{
			"mo",
			"`a"
		},
		{
			"ya",
			"a"
		},
		{
			"yi",
			"i"
		},
		{
			"yu",
			"u"
		},
		{
			"ye",
			"e"
		},
		{
			"yo",
			"o"
		},
		{
			"ra",
			"o"
		},
		{
			"ri",
			"i"
		},
		{
			"ru",
			"a"
		},
		{
			"re",
			"i"
		},
		{
			"ro",
			"o-"
		},
		{
			"la",
			"a"
		},
		{
			"li",
			"i"
		},
		{
			"lu",
			"u"
		},
		{
			"le",
			"i"
		},
		{
			"lo",
			"a"
		},
		{
			"wa",
			"^a"
		},
		{
			"wi",
			"^i-"
		},
		{
			"wu",
			"u-"
		},
		{
			"we",
			"^i-"
		},
		{
			"wo",
			"^o-"
		},
		{
			"va",
			"`a"
		},
		{
			"vi",
			"`i"
		},
		{
			"vu",
			"`u"
		},
		{
			"ve",
			"`u"
		},
		{
			"vo",
			"`a"
		}
	};

	// Token: 0x04000551 RID: 1361
	private static Dictionary<char, string> englishPronunDictionary = new Dictionary<char, string>
	{
		{
			'a',
			"a"
		},
		{
			'i',
			"i"
		},
		{
			'u',
			"u"
		},
		{
			'e',
			"e"
		},
		{
			'o',
			"o"
		},
		{
			'n',
			"n"
		},
		{
			'b',
			"u"
		},
		{
			'c',
			"u"
		},
		{
			'd',
			"o"
		},
		{
			'f',
			"u"
		},
		{
			'g',
			"u"
		},
		{
			'h',
			"u"
		},
		{
			'j',
			"i"
		},
		{
			'k',
			"u"
		},
		{
			'l',
			"u"
		},
		{
			'm',
			"u"
		},
		{
			'p',
			"u"
		},
		{
			'q',
			"u"
		},
		{
			'r',
			"a"
		},
		{
			's',
			"u"
		},
		{
			't',
			"o"
		},
		{
			'v',
			"u"
		},
		{
			'w',
			"u"
		},
		{
			'x',
			"uu"
		},
		{
			'y',
			"i"
		},
		{
			'z',
			"u"
		}
	};

	// Token: 0x04000552 RID: 1362
	private static Dictionary<char, string> japanesePostPhraseDictionary = new Dictionary<char, string>
	{
		{
			'ぁ',
			"a"
		},
		{
			'ぃ',
			"i"
		},
		{
			'ぅ',
			"u"
		},
		{
			'ぇ',
			"e"
		},
		{
			'ぉ',
			"o"
		},
		{
			'ァ',
			"a"
		},
		{
			'ィ',
			"i"
		},
		{
			'ゥ',
			"u"
		},
		{
			'ェ',
			"e"
		},
		{
			'ォ',
			"o"
		}
	};

	// Token: 0x04000553 RID: 1363
	private static Dictionary<string, string> japanesePhraseDictionary = new Dictionary<string, string>
	{
		{
			"きぁ",
			"^a"
		},
		{
			"きぃ",
			"i"
		},
		{
			"きぅ",
			"u"
		},
		{
			"きぇ",
			"^e"
		},
		{
			"きぉ",
			"^o"
		},
		{
			"しぁ",
			"^a"
		},
		{
			"しぃ",
			"i"
		},
		{
			"しぅ",
			"u"
		},
		{
			"しぇ",
			"^e"
		},
		{
			"しぉ",
			"^o"
		},
		{
			"にぁ",
			"^a"
		},
		{
			"にぃ",
			"i"
		},
		{
			"にぅ",
			"u"
		},
		{
			"にぇ",
			"^e"
		},
		{
			"にぉ",
			"^o"
		},
		{
			"ひぁ",
			"^a"
		},
		{
			"ひぃ",
			"i"
		},
		{
			"ひぅ",
			"u"
		},
		{
			"ひぇ",
			"^e"
		},
		{
			"ひぉ",
			"^o"
		},
		{
			"びぁ",
			"`a"
		},
		{
			"びぃ",
			"`i"
		},
		{
			"びぅ",
			"`u"
		},
		{
			"びぇ",
			"`e"
		},
		{
			"びぉ",
			"`o"
		},
		{
			"ぴぁ",
			"`a"
		},
		{
			"ぴぃ",
			"`i"
		},
		{
			"ぴぅ",
			"`u"
		},
		{
			"ぴぇ",
			"`e"
		},
		{
			"ぴぉ",
			"`o"
		},
		{
			"まぁ",
			"`a"
		},
		{
			"まぃ",
			"`i"
		},
		{
			"まぅ",
			"`u"
		},
		{
			"まぇ",
			"`e"
		},
		{
			"まぉ",
			"`o"
		},
		{
			"りぁ",
			"^a"
		},
		{
			"りぃ",
			"i"
		},
		{
			"りぅ",
			"u"
		},
		{
			"りぇ",
			"^e"
		},
		{
			"りぉ",
			"^o"
		},
		{
			"キァ",
			"^a"
		},
		{
			"キィ",
			"i"
		},
		{
			"キゥ",
			"u"
		},
		{
			"キェ",
			"^e"
		},
		{
			"キォ",
			"^o"
		},
		{
			"シァ",
			"^a"
		},
		{
			"シィ",
			"i"
		},
		{
			"シゥ",
			"u"
		},
		{
			"シェ",
			"^e"
		},
		{
			"シォ",
			"^o"
		},
		{
			"ニァ",
			"^a"
		},
		{
			"ニィ",
			"i"
		},
		{
			"ニゥ",
			"u"
		},
		{
			"ニェ",
			"^e"
		},
		{
			"ニォ",
			"^o"
		},
		{
			"ヒァ",
			"`a"
		},
		{
			"ヒィ",
			"`i"
		},
		{
			"ヒゥ",
			"`u"
		},
		{
			"ヒェ",
			"`e"
		},
		{
			"ヒォ",
			"`o"
		},
		{
			"ビァ",
			"`a"
		},
		{
			"ビィ",
			"`i"
		},
		{
			"ビゥ",
			"`u"
		},
		{
			"ビェ",
			"`e"
		},
		{
			"ビォ",
			"`o"
		},
		{
			"ピァ",
			"`a"
		},
		{
			"ピィ",
			"`i"
		},
		{
			"ピゥ",
			"`u"
		},
		{
			"ピェ",
			"`e"
		},
		{
			"ピォ",
			"`o"
		},
		{
			"ミァ",
			"`a"
		},
		{
			"ミィ",
			"`i"
		},
		{
			"ミゥ",
			"`u"
		},
		{
			"ミェ",
			"`e"
		},
		{
			"ミォ",
			"`o"
		},
		{
			"リァ",
			"^a"
		},
		{
			"リィ",
			"i"
		},
		{
			"リゥ",
			"u"
		},
		{
			"リェ",
			"^e"
		},
		{
			"リォ",
			"^o"
		},
		{
			"ヴァ",
			"`a"
		},
		{
			"ヴィ",
			"`i"
		},
		{
			"ヴゥ",
			"`u"
		},
		{
			"ヴェ",
			"`e"
		},
		{
			"ヴォ",
			"`o"
		}
	};

	// Token: 0x04000554 RID: 1364
	private static Dictionary<char, string> punctuatDictionary = new Dictionary<char, string>
	{
		{
			'.',
			" "
		},
		{
			',',
			" "
		},
		{
			'!',
			" "
		},
		{
			'?',
			" "
		},
		{
			'．',
			" "
		},
		{
			'，',
			" "
		},
		{
			'！',
			" "
		},
		{
			'？',
			" "
		},
		{
			'、',
			" "
		},
		{
			'。',
			" "
		}
	};

	// Token: 0x04000555 RID: 1365
	private static Dictionary<char, string> japanesePronunDictionary = new Dictionary<char, string>
	{
		{
			'ー',
			"-"
		},
		{
			'―',
			"-"
		},
		{
			'〜',
			"-"
		},
		{
			'ぁ',
			"a"
		},
		{
			'ぃ',
			"i"
		},
		{
			'ぅ',
			"u"
		},
		{
			'ぇ',
			"e"
		},
		{
			'ぉ',
			"o"
		},
		{
			'あ',
			"a"
		},
		{
			'い',
			"i"
		},
		{
			'う',
			"u"
		},
		{
			'え',
			"e"
		},
		{
			'お',
			"o"
		},
		{
			'か',
			"a"
		},
		{
			'き',
			"i"
		},
		{
			'く',
			"u"
		},
		{
			'け',
			"e"
		},
		{
			'こ',
			"o"
		},
		{
			'が',
			"a"
		},
		{
			'ぎ',
			"i"
		},
		{
			'ぐ',
			"u"
		},
		{
			'げ',
			"e"
		},
		{
			'ご',
			"o"
		},
		{
			'さ',
			"^a"
		},
		{
			'し',
			"i"
		},
		{
			'す',
			"u"
		},
		{
			'せ',
			"^e"
		},
		{
			'そ',
			"^o"
		},
		{
			'ざ',
			"^a"
		},
		{
			'じ',
			"i"
		},
		{
			'ず',
			"u"
		},
		{
			'ぜ',
			"^e"
		},
		{
			'ぞ',
			"^o"
		},
		{
			'た',
			"^a"
		},
		{
			'ち',
			"i"
		},
		{
			'つ',
			"u"
		},
		{
			'て',
			"^e"
		},
		{
			'と',
			"^o"
		},
		{
			'だ',
			"^a"
		},
		{
			'ぢ',
			"i"
		},
		{
			'づ',
			"u"
		},
		{
			'で',
			"^e"
		},
		{
			'ど',
			"^o"
		},
		{
			'っ',
			"/"
		},
		{
			'な',
			"^a"
		},
		{
			'に',
			"i"
		},
		{
			'ぬ',
			"u"
		},
		{
			'ね',
			"^e"
		},
		{
			'の',
			"^o"
		},
		{
			'は',
			"a"
		},
		{
			'ひ',
			"i"
		},
		{
			'ふ',
			"u"
		},
		{
			'へ',
			"e"
		},
		{
			'ほ',
			"o"
		},
		{
			'ば',
			"`a"
		},
		{
			'び',
			"`i"
		},
		{
			'ぶ',
			"`u"
		},
		{
			'べ',
			"`e"
		},
		{
			'ぼ',
			"`o"
		},
		{
			'ぱ',
			"`a"
		},
		{
			'ぴ',
			"`i"
		},
		{
			'ぷ',
			"`u"
		},
		{
			'ぺ',
			"`e"
		},
		{
			'ぽ',
			"`o"
		},
		{
			'ま',
			"`a"
		},
		{
			'み',
			"`i"
		},
		{
			'む',
			"`u"
		},
		{
			'め',
			"`e"
		},
		{
			'も',
			"`o"
		},
		{
			'ゃ',
			"a"
		},
		{
			'ゅ',
			"u"
		},
		{
			'ょ',
			"o"
		},
		{
			'や',
			"a"
		},
		{
			'ゆ',
			"u"
		},
		{
			'よ',
			"o"
		},
		{
			'ら',
			"^a"
		},
		{
			'り',
			"i"
		},
		{
			'る',
			"u"
		},
		{
			'れ',
			"^e"
		},
		{
			'ろ',
			"^o"
		},
		{
			'ゎ',
			"a"
		},
		{
			'ゐ',
			"i"
		},
		{
			'を',
			"o"
		},
		{
			'わ',
			"^a"
		},
		{
			'ゑ',
			"e"
		},
		{
			'ん',
			"n"
		},
		{
			'ァ',
			"a"
		},
		{
			'ィ',
			"i"
		},
		{
			'ゥ',
			"u"
		},
		{
			'ェ',
			"e"
		},
		{
			'ォ',
			"o"
		},
		{
			'ア',
			"a"
		},
		{
			'イ',
			"i"
		},
		{
			'ウ',
			"u"
		},
		{
			'エ',
			"e"
		},
		{
			'オ',
			"o"
		},
		{
			'カ',
			"a"
		},
		{
			'キ',
			"i"
		},
		{
			'ク',
			"u"
		},
		{
			'ケ',
			"e"
		},
		{
			'コ',
			"o"
		},
		{
			'ガ',
			"a"
		},
		{
			'ギ',
			"i"
		},
		{
			'グ',
			"u"
		},
		{
			'ゲ',
			"e"
		},
		{
			'ゴ',
			"o"
		},
		{
			'サ',
			"^a"
		},
		{
			'シ',
			"i"
		},
		{
			'ス',
			"u"
		},
		{
			'セ',
			"^e"
		},
		{
			'ソ',
			"^o"
		},
		{
			'ザ',
			"^a"
		},
		{
			'ジ',
			"i"
		},
		{
			'ズ',
			"u"
		},
		{
			'ゼ',
			"^e"
		},
		{
			'ゾ',
			"^o"
		},
		{
			'タ',
			"^a"
		},
		{
			'チ',
			"i"
		},
		{
			'ツ',
			"u"
		},
		{
			'テ',
			"^e"
		},
		{
			'ト',
			"^o"
		},
		{
			'ダ',
			"^a"
		},
		{
			'ヂ',
			"i"
		},
		{
			'ヅ',
			"u"
		},
		{
			'デ',
			"^e"
		},
		{
			'ド',
			"^o"
		},
		{
			'ッ',
			"/"
		},
		{
			'ナ',
			"^a"
		},
		{
			'ニ',
			"i"
		},
		{
			'ヌ',
			"u"
		},
		{
			'ネ',
			"^e"
		},
		{
			'ノ',
			"^o"
		},
		{
			'ハ',
			"a"
		},
		{
			'ヒ',
			"i"
		},
		{
			'フ',
			"u"
		},
		{
			'ヘ',
			"e"
		},
		{
			'ホ',
			"o"
		},
		{
			'バ',
			"`a"
		},
		{
			'ビ',
			"`i"
		},
		{
			'ブ',
			"`u"
		},
		{
			'ベ',
			"`e"
		},
		{
			'ボ',
			"`o"
		},
		{
			'パ',
			"`a"
		},
		{
			'ピ',
			"`i"
		},
		{
			'プ',
			"`u"
		},
		{
			'ペ',
			"`e"
		},
		{
			'ポ',
			"`o"
		},
		{
			'マ',
			"`a"
		},
		{
			'ミ',
			"`i"
		},
		{
			'ム',
			"`u"
		},
		{
			'メ',
			"`e"
		},
		{
			'モ',
			"`o"
		},
		{
			'ャ',
			"a"
		},
		{
			'ュ',
			"u"
		},
		{
			'ョ',
			"o"
		},
		{
			'ヤ',
			"a"
		},
		{
			'ユ',
			"u"
		},
		{
			'ヨ',
			"o"
		},
		{
			'ラ',
			"^a"
		},
		{
			'リ',
			"i"
		},
		{
			'ル',
			"u"
		},
		{
			'レ',
			"^e"
		},
		{
			'ロ',
			"^o"
		},
		{
			'ヮ',
			"a"
		},
		{
			'ヰ',
			"i"
		},
		{
			'ヲ',
			"o"
		},
		{
			'ワ',
			"^a"
		},
		{
			'ヱ',
			"e"
		},
		{
			'ン',
			"n"
		},
		{
			'ヴ',
			"`u"
		},
		{
			'ヵ',
			"a"
		},
		{
			'ヶ',
			"e"
		}
	};

	// Token: 0x04000556 RID: 1366
	private AudioSource _audioSource;

	// Token: 0x04000557 RID: 1367
	private List<MMD4MecanimSpeechHelper.PlayingData> _playingDataList = new List<MMD4MecanimSpeechHelper.PlayingData>();

	// Token: 0x04000558 RID: 1368
	private int _playingPos;

	// Token: 0x04000559 RID: 1369
	private bool _isPlayingAudioClip;

	// Token: 0x0400055A RID: 1370
	private bool _isPlayingMorph;

	// Token: 0x0400055B RID: 1371
	private int _validateMorphBits;

	// Token: 0x020000A7 RID: 167
	private struct MorphData
	{
		// Token: 0x0400055C RID: 1372
		public char morphChar;

		// Token: 0x0400055D RID: 1373
		public string morphName;

		// Token: 0x0400055E RID: 1374
		public float morphLength;
	}

	// Token: 0x020000A8 RID: 168
	private class PlayingData
	{
		// Token: 0x0400055F RID: 1375
		public AudioClip audioClip;

		// Token: 0x04000560 RID: 1376
		public float playingLength;

		// Token: 0x04000561 RID: 1377
		public float playingTime;

		// Token: 0x04000562 RID: 1378
		public int morphPos = -1;

		// Token: 0x04000563 RID: 1379
		public float morphTime;

		// Token: 0x04000564 RID: 1380
		public List<MMD4MecanimSpeechHelper.MorphData> morphDataList;
	}
}
